/*
 * $Id: TaskFTDetailsDAO.java,v 1.4 2009/07/10 15:18:35 navdeep_mahajan Exp $
 * 
 * Copyright (C) 2006 General Electric Company. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 * 
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */
package com.ge.healthcare.autosc.common.database.dao;

import java.util.ArrayList;
import java.util.List;

import org.springmodules.cache.annotations.Cacheable;

import com.ge.healthcare.autosc.common.ASCUtil;
import com.ge.healthcare.autosc.common.database.pojo.CfgTaskFtDetails;

/**
 * @author 212042764
 * 
 */
public class TaskFTDetailsDAO extends BaseDAO implements ITaskFTDetailsDAO {
	/**
	 * Eclipse generated
	 */
	private static final long serialVersionUID = -1280390379243867089L;
	private static final String TABLE_NAME = "com.ge.healthcare.autosc.common.database.pojo.CfgTaskFtDetails";
	private static final String COL_TASK_TYPE_NAME = "id.taskTypeName";
	private static final String COL_ORDERING = "ordering";

	public TaskFTDetailsDAO() {
		super(TABLE_NAME);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @seecom.ge.healthcare.autosc.common.database.dao.ITaskFTDetailsDAO#
	 * getFileTransferDetailsForTaskType(java.lang.String)
	 */
	@Cacheable(modelId="TaskFTDetailsDAOCacheModel")
	public List<CfgTaskFtDetails> getFileTransferDetailsForTaskType(
			String taskTypeName) {
		List<?> rtvdFTDetails = this.findByProperty(COL_TASK_TYPE_NAME,
				taskTypeName, COL_ORDERING);
		if (ASCUtil.isNullOrEmptyList(rtvdFTDetails)) {
			return null;
		}
		List<CfgTaskFtDetails> ftDetailsLst = new ArrayList<CfgTaskFtDetails>();
		for (Object rtvdObject : rtvdFTDetails) {
			ftDetailsLst.add((CfgTaskFtDetails) rtvdObject);
		}
		return ftDetailsLst;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.ge.healthcare.autosc.common.database.dao.ITaskFTDetailsDAO#saveAlways
	 * (java.lang.Object)
	 */
	public void saveAlways(Object pojo) {
		super.save(pojo);
	}

}
